package com.chexiehui.jc.mvp.forum;

import com.chexiehui.jc.Constants;
import com.chexiehui.jc.base.BaseModel;
import com.chexiehui.jc.base.BasePage;
import com.chexiehui.jc.base.BaseView;
import com.chexiehui.jc.entity.PostCommentInfo;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @Description 帖子详情
 * @Auth SongJun
 * @Date 2019/11/20 10:05
 **/
public interface ForumAppraiseDetailsCovenant {

    interface View extends BaseView {

        void onGetCommentInfoSuccess(BaseModel<PostCommentInfo> successResult);

        void onGetCommentInfoFailure(BaseModel<Object> failureResult);

        void onGetCommentListSuccess(BaseModel<BasePage<PostCommentInfo>> successResult);

        void onGetCommentListFailure(BaseModel<Object> failureResult);

        void onAddCommentSuccess(BaseModel<PostCommentInfo> successResult);

        void onAddCommentFailure(BaseModel<Object> failureResult);

        void onDoDianZanSuccess(BaseModel<Integer> successResult);

        void onDoDianZanFailure(BaseModel<Object> failureResult);

        String getPostId();
        String getCommentId();
    }

    interface Stores {
        @FormUrlEncoded
        @POST(Constants.URL_GET_POSTS_COMMENT_INFO)
        Observable<BaseModel<PostCommentInfo>> getCommentInfo(
                @Field("id") String id
        );
        @FormUrlEncoded
        @POST(Constants.URL_GET_POSTS_COMMENT_CHILD_LIST)
        Observable<BaseModel<BasePage<PostCommentInfo>>> getCommentList(
                @Field("id") String id,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize
        );

        @FormUrlEncoded
        @POST(Constants.URL_POST_ADD_COMMENT)
        Observable<BaseModel<PostCommentInfo>> addComment(
                @Field("postId") String postId,
                @Field("commentId") String commentId,
                @Field("content") String content
        );

        @FormUrlEncoded
        @POST(Constants.URL_POST_ADD_COMMENT)
        Observable<BaseModel<PostCommentInfo>> addReply(
                @Field("postId") String postId,
                @Field("commentId") String commentId,
                @Field("content") String content,
                @Field("replyId") String replyId,
                @Field("replyName") String replyName,
                @Field("ReplyContent") String ReplyContent
        );

        @FormUrlEncoded
        @POST(Constants.URL_POST_DIAN_ZAN)
        Observable<BaseModel<Object>> doDianZan(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

    }

    interface Presenter {
        void getCommentInfo();
        void getCommentList(int pageNum);

        void addComment(String content);
        void addReply(String content, String replyId,String replyName,String ReplyContent);

        void doDianZan(String objId, int position);
    }

}